package com.allen.app.common.utils;

import java.util.Objects;
import lombok.experimental.UtilityClass;

/**
 * Description: 逻辑校验
 *
 * @author Limiaojun
 * @version 1.0
 * @date: 2018-05-31 17:52:20
 * @since JDK 1.8
 */
@UtilityClass
public class ValidateUtils {

    public void validEqu(Object sourceId, Object targetId, String msg, Object... param) {
        Args.check(Objects.equals(sourceId, targetId), msg, param);
    }

    public void validNotNull(Object obj, String msg, Object... param) {
        Args.check(CheckObjectUtils.nonNull(obj), msg, param);
    }

    public void validNull(Object obj, String msg, Object... param) {
        Args.check(CheckObjectUtils.isNull(obj), msg, param);
    }

    public void check(final boolean expression, final String message,Object... param) {
        Args.check(expression, message, param);
    }
}
